package com.example.x6.configurationmaintenance.Dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import com.example.x6.configurationmaintenance.Interface.OnYesOrNoClick;
import com.example.x6.configurationmaintenance.R;

public class YesOrNoDialog {
    private final String TAG = getClass().getSimpleName();
    AlertDialog.Builder builder;
    private Context context;
    private String message = "";
    private OnYesOrNoClick onYesOrNoClick;
    private String title = "";

    public YesOrNoDialog(Context context2) {
        this.context = context2;
        this.builder = new AlertDialog.Builder(context2);
    }

    public void showDialog() {
        this.builder.setTitle(this.title);
        this.builder.setMessage(this.message);
        this.builder.setPositiveButton(this.context.getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
            /* class com.example.x6.configurationmaintenance.Dialog.YesOrNoDialog.AnonymousClass1 */

            public void onClick(DialogInterface dialogInterface, int i) {
                YesOrNoDialog.this.onYesOrNoClick.onYesPressed();
            }
        });
        this.builder.setNegativeButton(this.context.getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
            /* class com.example.x6.configurationmaintenance.Dialog.YesOrNoDialog.AnonymousClass2 */

            public void onClick(DialogInterface dialogInterface, int i) {
                YesOrNoDialog.this.onYesOrNoClick.onNoPressed();
            }
        });
        this.builder.show();
    }

    public void setTitle(String title2) {
        if (title2 != null) {
            this.title = title2;
            this.builder.setTitle(this.title);
        }
    }

    public void setMessage(String message2) {
        if (message2 != null) {
            this.message = message2;
            this.builder.setMessage(this.message);
        }
    }

    public void setOnYesOrNoClick(OnYesOrNoClick onYesOrNoClick2) {
        this.onYesOrNoClick = onYesOrNoClick2;
    }
}
